Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building hosted under FreeBSD #1696

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

ALTracer
Copy link
Contributor

@ALTracer ALTracer commented Dec 9, 2023

Detailed description

  • Not a feature.
  • The problem is BMDA fails to build from source (FTBFS) on FreeBSD because of no <alloca.h> and missing hidapi-hidraw.
  • PR solves this by purging all (3) of alloca.h references in light of Msvc fixes #1661 and guarding the remaining inclusion by OS-specific macro. And adding a proper/available hidapi library name.

Tested on NomadBSD 13.2-RELEASE and a bunch of cheap adapters I have. HOSTED_BMP_ONLY=0. CMSIS-DAP (Picoprobe, free-dap) are detected, opened in v2/bulk mode and result in successful scan of an empty chain (nothing wired up). BMP-compatibles work only after indicating a --device /dev/ttyU0 and under root privileges (there is no /dev/serial/by-id); including scanning SWD and attaching to a Cortex-M target. JLink and STLink/v2 result in a crash in libusb.so.3.0.0 due to write into zero page on first bulk write transaction. ASAN=1 also works btw. FTDI MPSSE not tested. Noting that devel/openocd-0.11.0 works on the same machine with the same JLink/STLink without crashing, and devel/gdb looks like built with multiarch support.

Building: sudo pkg install libftdi1 hidapi and then gmake -C src/ PROBE_HOST=hosted HOSTED_BMP_ONLY=0 CC=gcc12 -j6 because Makefiles of this project are incompatible with default bmake to which make aliases.
This PR does not cover building BMF and libopencm3 under *BSD. I could not install https://www.freshports.org/devel/gcc-arm-embedded/ due to symlink collisions, but python 3.9 is present (for GENHDR) and there may not be other problems to that.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

@DanielO may try using BMDA on his FreeBSD machine now, in addition to the Orbuculum suite (see orbcode/orbuculum#134)

* Tested on NomadBSD 13.2-RELEASE
* Use normal hidapi (without hidraw) which works with CMSIS-DAP
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to us - we'll get this merged after testing the result locally. @xobs could you please check if possible that this still builds under your MSVC setup?

@dragonmux dragonmux added this to the v2.0 release milestone Dec 9, 2023
@dragonmux dragonmux added Enhancement General project improvement Build system Build system BMD App Black Magic Debug App (aka. PC hosted) (not firmware) labels Dec 9, 2023
@xobs
Copy link
Contributor

xobs commented Dec 11, 2023

Absolutely no problems under my weird MSVC testcase.

@dragonmux dragonmux merged commit a42f91a into blackmagic-debug:main Dec 12, 2023
6 checks passed
@ALTracer ALTracer deleted the fix/FreeBSD branch December 29, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BMD App Black Magic Debug App (aka. PC hosted) (not firmware) Build system Build system Enhancement General project improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants